<%@ Page Language="C#" MasterPageFile="~/Admin.master" AutoEventWireup="true" CodeFile="TemplateProperties.aspx.cs" Inherits="TemplateProperties" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phMain" Runat="Server">
    <asp:Panel ID="pnlNotFound" Visible="false" runat="server">
        Sorry template not found.
    </asp:Panel>
    <asp:Panel ID="pnlFound" Visible="false" runat="server">
        '<asp:Literal ID="litName" runat="server" />' Template Properties
        <fieldset>
            <legend>Current Properties</legend>
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id,ConcurencyId"
                DataSourceID="dsTemplateProperties" EmptyDataText="There are currently no properties set up.">
                <Columns>
                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                    <asp:TemplateField HeaderText="Type" SortExpression="TypeId">
                        <EditItemTemplate>
                            <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="dsPropertyType"
                                DataTextField="Name" DataValueField="Id" SelectedValue='<%# Bind("TypeId") %>'>
                            </asp:DropDownList>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("TypeName") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                </Columns>
            </asp:GridView>
        </fieldset>
        <fieldset>
            <legend>Add New</legend>
            <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateInsertButton="True"
                AutoGenerateRows="False" DataKeyNames="Id,ConcurencyId" DataSourceID="dsTemplateProperties"
                DefaultMode="Insert" Height="50px" Width="125px">
                <Fields>
                    <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                    <asp:TemplateField HeaderText="Type" SortExpression="TypeId">
                        <EditItemTemplate>
                            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("TypeId") %>'></asp:TextBox>
                        </EditItemTemplate>
                        <InsertItemTemplate>
                            <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="dsPropertyType"
                                DataTextField="Name" DataValueField="Id" SelectedValue='<%# Bind("TypeId") %>'>
                            </asp:DropDownList>
                        </InsertItemTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("TypeId") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Fields>
            </asp:DetailsView>
        </fieldset>
        <acmsdc:TemplateControlDataSource ID="dsTemplateProperties" runat="server" OnSelectData="dsTemplateProperties_SelectData"
            OnUpdatingData="dsTemplateProperties_UpdatingData"/>
        <acmsdc:ControlTypeDataSource ID="dsPropertyType" runat="server" OnSelectData="dsPropertyType_SelectData"/>

    </asp:Panel>
</asp:Content>

